﻿using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Rigidbody2D))]
public class GiroRotate : Giro 
{
    public bool useSmooth = false;
    public int smooth = 2;

    float prevAngel;
	public override void FixedUpdate ()
    {
        base.FixedUpdate();
        RotateThis();
        prevAngel = -GetAngel();
	}

    void RotateThis()
    {
        float angel = useSmooth ? ((prevAngel * (smooth - 1)) + -GetAngel()) / smooth : -GetAngel();
        rigidbody2D.MoveRotation(angel);
        prevAngel = angel;
    }
}
